WinActivate("打开")
Sleep( 2000 )
ControlSetText ( "打开","","Edit1","C:\Users\hesy\Desktop\img" )
ControlClick ( "打开", "", "Button1" )
Sleep( 2000 )
Send("{TAB}")
Send("{TAB}")
Send("{TAB}")
Send("{TAB}")
Send("{TAB}")
Send("{TAB}")
Send("{TAB}")
Send("{TAB}")
Send("{TAB}")
Sleep ( 200 )
Send("{TAB}")
Sleep ( 200 )

;得到颜色分类的坐标
$colorTypeIndex = openColorType()
;上传图片
setColorTypeImg($colorTypeIndex)
ControlClick ( "打开", "", "Button1" )
;方法区
Func setColorTypeImg($colorTypeIndex)
  ; MsgBox(0, "读取的字符:", $colorTypeIndex)
   If $colorTypeIndex = 0  Then
  ; MsgBox(0, "信息",$colorTypeIndex)
   ;点击向右
   Send("{RIGHT}")
   Send("{LEFT}")
ElseIf $colorTypeIndex>0 Then
;	 MsgBox(0, "信息",$colorTypeIndex)
	 $str05 = "{RIGHT indexs}"
	 $str06 = StringReplace($str05,"indexs",$colorTypeIndex);
	 $replaceNum = @extended;
	  ;点击向右
	  Sleep( 3000 )
	  Send($str06)
   EndIf
EndFunc

Func openColorType()
     ; 检查打开的文件是否可为读
	  $file = FileOpen("C:\Users\hesy\Desktop\ImgCount.txt", 0)
	  If $file = -1 Then
		  MsgBox(0, "错误", "不能打开文件.")
		  Exit
	  EndIf
	  ; 每次读取一个字符,直到文件结束(译注:读中文必须设置为远大于1的值!)(译注的译注(thesnow):ANSI编码中,一个中文为两个字符/字节)
	  While 1
		Return  FileRead($file)
		  If @error = -1 Then ExitLoop
		 ; MsgBox(0, "读取的字符:", $chars)
	  Wend
	  FileClose($file)
EndFunc





